Putting $$s in the middle of an `equation` environment: why doesn't Latex complain?

Posted by Charles Stewart on Stack Overflow See other posts from Stack Overflow or by Charles Stewart
Published on 2010-05-24T12:59:15Z Indexed on 2010/05/24 13:01 UTC
Read the original article Hit count: 212

Filed under:
|

I was surprised that the Latex code from a recent question didn't throw up any errors, and even more surprised on further investigation, that Crowley's explanation seems to be true. My intuition about the \begin{equation} ... \end{equation} code is clearly off, what's really going on?

Consider this, slightly adapted code: \begin{equation} 1: e^{i\pi}+1=0 $$ 2: B\"ob $$ 3: e=mc^2 \end{equation}

This seems to prove that Crowley's explanation of such code, namely that "What that code says to LaTeX is begin equation, end it, begin it again, typeset definition of tangens and end the equation" is right: lines 1&3 can only be typeset in maths mode, line 2 only in text mode.

Shouldn't Latex see that the \end{equation} is ending a display math that wasn't started by the \begin{equation}?

© Stack Overflow or respective owner

Related posts about latex

Related posts about intuition